Fix _login to pass arguments to the server unconditionally, rather than
authorEwan Mellor <ewan@xensource.com>
Mon, 18 Dec 2006 00:14:40 +0000 (00:14 +0000)
committerEwan Mellor <ewan@xensource.com>
Mon, 18 Dec 2006 00:14:40 +0000 (00:14 +0000)
requiring precisely two on the client-side.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
tools/python/xen/xm/XenAPI.py

index 1c1bc41e948186f5e44c13969b300546ee84d09e..5cf929f48cbc6c7d9eff922c6a47ac51897a3df2 100644 (file)
@@ -84,23 +84,23 @@ class Session(xen.util.xmlrpclib2.ServerProxy):
 
     def xenapi_request(self, methodname, params):
         if methodname.startswith('login'):
-            self._login(methodname, *params)
+            self._login(methodname, params)
             return None
         else:
             full_params = (self._session,) + params
             return _parse_result(getattr(self, methodname)(*full_params))
 
 
-    def _login(self, method, username, password):
+    def _login(self, method, params):
         self._session = _parse_result(
-            getattr(self, 'session.%s' % method)(username, password))
+            getattr(self, 'session.%s' % method)(*params))
 
 
     def __getattr__(self, name):
         if name == 'xenapi':
             return _Dispatcher(self.xenapi_request, None)
         elif name.startswith('login'):
-            return lambda u, p: self._login(name, u, p)
+            return lambda *params: self._login(name, params)
         else:
             return xen.util.xmlrpclib2.ServerProxy.__getattr__(self, name)